﻿<?php
include("../inc/global.inc");
if($_POST[act]){
   if($_SESSION['chkCode']==$_POST['c_code']){
           $sql="select * from job_per where p_user='$_POST[m_userid]'";
           $rs=@mysql_query($sql);
           $row=@mysql_fetch_array($rs);
           if(!$row['id']){
		        $psw=substr(md5($_POST[m_password]),7,19);
				@mysql_query("insert into job_per (p_user,p_psw,p_email,p_addtime) values ('$_POST[m_userid]','$psw','$_POST[m_email]','".date("Y-m-d H:i:s")."')");
				//login
				$login_rs=@mysql_query("select * from job_per where p_user='$_POST[m_userid]'");
				$login_row=@mysql_fetch_array($login_rs);
				@mysql_query("update job_per set p_logintime='".date("y-m-d H:i:s")."' where id='$login_row[id]'");
				setcookie("job_user_id",$login_row[id],time()+86400,"/","sandib2b.cn");
				setcookie("job_user_name",$login_row[p_user],time()+86400,"/","sandib2b.cn");
				
				
								//start sent email
		       
			   
					 $content=iconv("utf-8","gb2312","<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN' 'http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd'>
<HTML xmlns='http://www.w3.org/1999/xhtml'>
<HEAD>
<TITLE>邮件来自三帝招聘网</TITLE>
<META http-equiv=Content-Type content='text/html; charset=gb2312'>
<style type='text/css'>
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	font-size: 12px;
	FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif;
	background-color: #FFFFFF;
}
a:link {
	color: #003399;
	text-decoration: underline;
}
a:hover {
	color: #FF6600;
	text-decoration: underline;
}
a:active {
	color: #003399;
	text-decoration: underline;
}
a:visited {
	color: #003399;
	text-decoration: underline;
}



#mail {
	padding: 0px;
	width: 622px;
	margin-top: 0px;
	margin-right: auto;
	margin-bottom: 0px;
	margin-left: auto;
	border-right-width: 1px;
	border-left-width: 1px;
	border-right-style: solid;
	border-left-style: solid;
	border-right-color: #ECE9D8;
	border-left-color: #ECE9D8;
}
#mail .info .to {
	line-height: 22px;
}

#mail .info .title {
	font-family: Arial;
	font-size: 19px;
	padding: 5px;
	background-color: #EBEBEB;
}

#mail .logo {
	float: left;
	padding-top: 13px;
}
#mail .headbg {
	float: right;
}
#mail .info {
	padding: 10px;
}
#mail .info .note {
	background-color: #ECF3FB;
	padding: 5px;
	line-height: 18px;
}

#mail .foot {
	background-color: #7EB1DA;
	padding: 6px;
	text-align: right;
}

.onl {
	clear: both;
}
-->
</style>
</HEAD>
<BODY>
<div id='mail'>
<div class='logo'><img src='http://www.sandib2b.cn/images/logo.gif' width='388' height='58'></div>
<div class='headbg'><img src='http://www.sandib2b.cn/images/headbg.gif' width='220' height='75'></div>
<div class='onl'></div>
<table width='100%' border='0' cellpadding='0' cellspacing='0'>
  <tr>
    <td height='42' align='right' valign='bottom' background='http://www.sandib2b.cn/images/webbg.gif'><img src='http://www.sandib2b.cn/images/messbg.gif' width='257' height='28'></td>
    </tr>
</table>
<div class='info'>
  <table cellspacing='0' cellpadding='0' width='100%' align='center' border='0'>
    <tbody>
      <tr>
        <td width='593' height='300' valign='top'><div><strong>您好,"."$_POST[m_userid]"."</strong>
                <div class='to'>会员账号:"."$_POST[m_userid]"."<br>
                  密码:$_POST[m_password]<br>
                  欢迎注册三帝招聘网个人会员，请登录完善您的个人信息，祝您找到合适的工作。</a>
				  <br>
				  <br>
                  <br>
				  <br>
				  三帝贸易网招聘频道：<A href='http://job.sandib2b.cn/' target='_blank'>http://job.sandib2b.cn</A>
				  <BR>
                  <br>
				  警告：系统邮件请勿回复！
                </div>
          </div></td>
      </tr>
    </tbody>
  </table>
</div>
<div class='foot'>国内专业招聘平台<font color='#CC0000'>三帝招聘网</font></div>
</div>
</BODY>
</HTML>");
					 
					
					
					 sendmail($_POST['m_email'],"三帝贸易网招聘会员注册",$content);
                     //sent email end
				
				
				
				echo "<script>location='index_2.php';</script>";
				
		   }else{
		   echo "<script>alert('该账号已经存在');location='javascript:history.go(-1)';</script>";
		   }
   }else{
       echo "<script>alert('验证码错误');location='javascript:history.go(-1)';</script>";
   }
}
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>新用户注册-简历中心-三帝招聘网</title>
<link href="../css/body.css" rel="stylesheet" type="text/css" />
<link href="../css/link.css" rel="stylesheet" type="text/css" />
<link href="../css/head_2.css" rel="stylesheet" type="text/css" />
<link href="../css/foot.css" rel="stylesheet" type="text/css" />
<link href="../css/reg.css" rel="stylesheet" type="text/css" />

<script src="../js/join.js" type="text/javascript" charset="gb2312"></script>
</head>
<body>
<?php include("../inc/top.php"); ?>
<div class="onl"></div>
<div id="mian" class="topside6 sideyellow1">
<form method="post" action="" onsubmit="return checkform()" name="form1">
<div class="title3 size12">请认真、仔细地填写以下信息，有助于你获得招聘单位录取。</div>
<div class="content size14">
<div class="title2 b">个人注册</div>
  <table width="100%" height="196" border="0" cellpadding="0" cellspacing="0" class="table">
    <tbody>
      <tr>
        <td width="150" height="14" align="right" bgcolor="#F4F4F0" >&nbsp;</td>
        <td width="312" height="14" bgcolor="#F4F4F0" >&nbsp;</td>
        <td width="296" bgcolor="#F4F4F0" ></td>
      </tr>
      <tr>
        <td height="14" align="right" ><span class="StarRed"> * </span>用 户 名</td>
        <td width="312" height="14" ><input name="m_userid" type="text" class="input1" id="m_userid" size="35" maxlength="40" onChange="callServer();"/>&nbsp;<span id="test1"></span></td>
        <td width="296" ><div class="txt">会员登录名由6-20个英文字母或数字组成。</div></td>
      </tr>
      <tr>
        <td width="150" height="28" align="right" bgcolor="#F4F4F0" ><span class="StarRed"> * </span>密　　码</td>
        <td height="28" bgcolor="#F4F4F0"><input name="m_password" type="password" class="input1" id="m_password" size="35" /></td>
        <td height="28" bgcolor="#F4F4F0"><div class="txt">密码由6-20个英文字母(区分大小写)或数字组成。</div></td>
      </tr>
      <tr>
        <td width="150" height="28" align="right" ><span class="StarRed"> * </span>确认密码</td>
        <td height="28" ><input name="m_password2" type="password" class="input1" id="m_password2" size="35" /></td>
        <td height="28" ><div class="txt">请再输入一遍您上面填写的密码。</div></td>
      </tr>
      <tr>
        <td height="28" align="right" bgcolor="#F4F4F0" ><span class="StarRed"> * </span>电子邮箱</td>
        <td height="28" bgcolor="#F4F4F0" ><input name="m_email" class="input" id="m_email" size="35" /></td>
        <td height="28" bgcolor="#F4F4F0" >&nbsp;</td>
      </tr>
      <tr>
        <td height="28" align="right" ><span class="StarRed"> * </span>验 证 码</td>
        <td height="28" ><input name="c_code" class="input2" id="c_code" size="6" maxlength="6" />
          <img src="../inc/chk_num.php" height="28" align="absmiddle"  id="img"/>&nbsp;&nbsp;<a href="#" name="test" id="test">看不清楚？</a></td>
        <td height="28" >&nbsp;</td>
      </tr>
      <tr>
        <td height="28" align="right" >&nbsp;</td>
        <td height="28" >&nbsp;</td>
        <td height="28" >&nbsp;</td>
      </tr>
    </tbody>
  </table>
  <table width="100%" border="0" cellpadding="0" cellspacing="0" class="table">
    <tbody>
      <tr>
        <td colspan="3" align="center" ><div class="content"><a href="http://www.sandib2b.cn/about/fuwu.php" target="_blank">点此阅读会员服务条款</a><br />
              <input type="hidden" value="sandib2b.cn" name="act" />
          <input type="submit" class="inputbutt" value="同意服务条款，提交注册信息"/><br /><br /></div></td>
      </tr>
    </tbody>
  </table>
</div>
</form>
</div>
<?php include("../inc/foot.php"); ?>

</body>
</html>
<script language="javascript">
function $(id){
return document.getElementById(id);
}
function checkform(){

 if($("m_userid").value.length>50||$("m_userid").value.length<6){
    alert("请按照要求输入会员登录名");
    $("m_userid").focus();
    return false;
 }
 
 
if($("m_userid").value!="")
 	 {
 	  	var temp = unisch($("m_userid").value)
		if(temp==true)
		{
		    alert("请按照要求输入会员登录名");
			$("m_userid").focus();
			return false;
		}
 	 }

	 
 if($("m_password").value.length<6){
    alert("请输入密码");
    $("m_password").focus();
    return false;
 }

if($("m_password2").value!=$("m_password").value){
alert("您两次输入的密码不一致");
$("m_password2").focus();
return false;
}



var pattern = /^([a-zA-Z0-9_.-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/;
　　　　if(!pattern.test($("m_email").value)){
			alert("请输入您的E-mail地址");
			$("m_email").focus();
			return false;
		}


if($("c_code").value.length!=5){
  alert("请输入您的验证码");
  $("c_code").focus();
  return false;
}

}

function unisch(String) 
{ 
	var Letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-"; 
	var i; 
	var c; 
	for( i = 0; i < String.length; i ++ ) 
	{ 
		c = String.charAt( i ); 
		if (Letters.indexOf( c ) ==-1) 
		{ 
			return true; 
		} 
	} 
	return false; 
} 

function test(img){
    var src=img.getAttribute("src");
    src=src+"?new="+Math.random(0,10);
    img.setAttribute("src",src);
}
function prepare(){
    var nav=document.getElementById("test");
    var name=nav.getAttribute("name");
    var str="test";
    if(name==str){
        nav.onclick=function(){
            var img=document.getElementById("img");
            test(img);
            return false;
        }
    }
}
window.onload=prepare;
</script>